//package com.aliwo.factory;
//
//import com.aliwo.constant.SJ;
//import com.aliwo.constant.SwitchableStatus;
//import com.aliwo.remote.model.JobInfoDO;
//import com.aliwo.request.QueryJobInfoRequest;
//import com.aliwo.request.response.JobInfoResponse;
//import org.springframework.beans.BeanUtils;
//import org.springframework.stereotype.Component;
//import org.springframework.util.StringUtils;
//import tech.powerjob.common.enums.DispatchStrategy;
//import tech.powerjob.common.enums.ExecuteType;
//import tech.powerjob.common.enums.ProcessorType;
//import tech.powerjob.common.enums.TimeExpressionType;
//import tech.powerjob.common.utils.CommonUtils;
//import com.google.common.collect.Lists;
///**
// * @author:xuyayuan
// * @date:2021/7/27 10:50
// * @description:TODO
// */
//@Component
//public class JobInfoFactory {
//    public JobInfoDO toDomain(QueryJobInfoRequest request){
//        JobInfoDO equipmentPoint = new JobInfoDO();
//        BeanUtils.copyProperties(request,equipmentPoint);
//        return equipmentPoint;
//    }
//
//    public JobInfoResponse toResponse(JobInfoDO jobInfoDO){
//            JobInfoResponse JobInfoResponse = new JobInfoResponse();
//            BeanUtils.copyProperties(jobInfoDO, JobInfoResponse);
//
//            TimeExpressionType timeExpressionType = TimeExpressionType.of(jobInfoDO.getTimeExpressionType());
//            ExecuteType executeType = ExecuteType.of(jobInfoDO.getExecuteType());
//            ProcessorType processorType = ProcessorType.of(jobInfoDO.getProcessorType());
//            DispatchStrategy dispatchStrategy = DispatchStrategy.of(jobInfoDO.getDispatchStrategy());
//
//            JobInfoResponse.setTimeExpressionType(timeExpressionType.name());
//            JobInfoResponse.setExecuteType(executeType.name());
//            JobInfoResponse.setProcessorType(processorType.name());
//            JobInfoResponse.setEnable(jobInfoDO.getStatus() == SwitchableStatus.ENABLE.getV());
//            JobInfoResponse.setDispatchStrategy(dispatchStrategy.name());
//
//            if (!StringUtils.isEmpty(jobInfoDO.getNotifyUserIds())) {
//                JobInfoResponse.setNotifyUserIds(SJ.COMMA_SPLITTER.splitToList(jobInfoDO.getNotifyUserIds()));
//            }else {
//                JobInfoResponse.setNotifyUserIds(Lists.newLinkedList());
//            }
//            JobInfoResponse.setNextTriggerTimeStr(CommonUtils.formatTime(jobInfoDO.getNextTriggerTime()));
//
//            return JobInfoResponse;
//        }
//    }
